package com.neudeu.zy;

public class HourlyEmployee extends ColaEmployee{

    //成员变量

    double salaryHour;  //每小时的工资
    double monthHour;   //每月工作的小时数

    //行为方法

    //此处使用了多态：子类重写了父类的同名方法


    @Override
    public double getSalary(int month) {

        double mySalary;

        if(monthHour>160){
             mySalary=160*salaryHour+(monthHour-160)*1.5*salaryHour;
        }else {
            mySalary=salaryHour*monthHour;
        }
        //计算有没有生日金
        mySalary+=super.getSalary(month);
        return mySalary;
    }



    public HourlyEmployee() {
    }

    public HourlyEmployee(String eName, int eBirthdayMonth,  double salaryHour, double monthHour) {
        super(eName, eBirthdayMonth);

        this.salaryHour = salaryHour;
        this.monthHour = monthHour;
    }



    public double getSalaryHour() {
        return salaryHour;
    }

    public void setSalaryHour(double salaryHour) {
        this.salaryHour = salaryHour;
    }

    public double getMonthHour() {
        return monthHour;
    }

    public void setMonthHour(double monthHour) {
        this.monthHour = monthHour;
    }
}
